import java.util.Arrays;
import java.util.Scanner;

public class Grouping {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (true){
            System.out.println("输入分组数：");
            int n = scanner.nextInt();//输入组数
            System.out.println("输入队员能力值:");
            int array[] = new int[3 * n];
            long sum = 0;
            for (int i = 0; i < (3 * n); i++) {
                array[i] = scanner.nextInt();
            }
            Arrays.sort(array);
            System.out.println("输出队伍平均能力值：");
            for (int i = 0; i < n; i++) {
                sum += array[array.length-(2*(i+1))];
            }
            System.out.println(sum);
        }
    }
}
